package main

import (
	"encoding/json"
	"io"
)

type Cmd struct {
	Cmd string `json:"cmd"`
	Arg CmdArg
}
type CmdArg struct {
	Uid        string `json:"uid"`
	TempleteId string `json:"templete_id"`
	ServerId   string `json:"server_id"`
}

func ParseCmd(r io.Reader) (*Cmd, error) {
	var cmd Cmd
	de := json.NewDecoder(r)

	if err := de.Decode(&cmd); err != nil {
		return nil, err
	}
	return &cmd, nil
}
